###############################################################################
# PHP fastcgi settings
# * Should set the document root in server {}
# * When not found the php script file, we should return 404 error.
# @author Jiankai Zeng <janpoem@163.com>
###############################################################################

location ~ ^.+\.php {
        if ($php_script_file = '') {
                set $php_script_file $document_root$fastcgi_script_name;
        }
        if (!-f $php_script_file) {
                return 404;
        }
        limit_req       zone=php burst=5;
        fastcgi_index   index.php;
        fastcgi_pass    #FASTCGI_PASS#;
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param   SCRIPT_FILENAME $php_script_file;
        fastcgi_param   PATH_INFO $fastcgi_path_info;
        fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
        include         #CONF_DIR#/fastcgi_params;
}